<template>
    <div class="dynamic-indicator">
        <div class="pulse-circle"></div>
        <span class="dynamic-text">{{text}}</span>
    </div>
</template>

<script setup lang="ts">
//增加文字传参
defineProps({
    text: {
        type: String,
        default: '动'
    }
})
</script>

<style scoped lang="scss">
.dynamic-indicator {
    position: relative;
    width: 20px;
    height: 20px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

/* 动态文字 */
.dynamic-text {
    position: relative;
    font-size: 12px;
    font-weight: bold;
    color: var(--el-color-danger);
    /* 活力红色 */
    z-index: 2;
    animation: textScale 1.5s ease-in-out infinite;
}

/* 脉冲光圈 */
.pulse-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 1px solid var(--el-color-danger);
    border-radius: 50%;
    animation:
        circlePulse 1.5s ease-out infinite,
        borderFlash 1.5s linear infinite;
}

/* 文字缩放动画 */
@keyframes textScale {

    0%,
    100% {
        transform: scale(0.9);
    }

    50% {
        transform: scale(1.1);
    }
}

/* 光圈扩散效果 */
@keyframes circlePulse {
    0%,
    100% {
        opacity: 0;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.3);
    }
}

/* 边框闪烁动画 */
@keyframes borderFlash {

    0%,
    100% {
        border-width: 1px;
        box-shadow: 0 0 2px var(--el-color-danger-light-5);
    }

    50% {
        border-width: 1px;
        box-shadow: 0 0 5px var(--el-color-danger-light-3);
    }
}
</style>